<template>
  <!-- 商品完成添加到购物车 -->
  <div class="cart-complete-wrap">
    <div class="cart-complete">
      <h3><i class="iconfont icon-hook"></i> 商品已成功加入购物车！</h3>
      <div class="goods">
        <div class="left-good">
          <div class="left-pic"><img :src="goodsInfo.skuDefaultImg" /></div>
          <div class="right-info">
            <p class="title">
              {{ goodsInfo.skuName }}
            </p>
            <p class="attr">
              {{ goodsInfo.skuDesc }} 数量：{{ $route.params.goodsNum }}
            </p>
          </div>
        </div>
        <div class="right-gocart">
          <router-link :to="`/goods/${goodsInfo.id}`" class="sui-btn btn-xlarge"
            >查看商品详情</router-link
          >
          <router-link to="/shopcart" class="sui-btn btn-xlarge btn-danger"
            >去购物车结算 &gt;
          </router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "AddCart",
  computed: {
    goodsInfo() {
      return JSON.parse(sessionStorage.getItem("GOODSINFO")) || {};
    },
  },
};
</script>

<style scoped lang="less">
.cart-complete-wrap {
  background-color: #f4f4f4;

  .cart-complete {
    width: 1200px;
    margin: 0 auto;
    border: 1px rgb(223, 222, 222) solid;
    h3 {
      font-weight: 600;
      font-size: 16px;
      color: #6aaf04;
      padding: 15px;
    }
    .goods {
      overflow: hidden;
      padding: 15px;
      display: flex;
      align-items: center;
      .left-good {
        float: left;
        .left-pic {
          border: 1px solid #dfdfdf;
          width: 80px;
          float: left;
          img {
            width: 80px;
            height: 80px;
          }
        }

        .right-info {
          width: 700px;
          color: #444;
          float: left;
          margin-left: 20px;
          .title {
            line-height: 28px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 14px;
          }

          .attr {
            color: #aaa;
          }
        }
      }

      .right-gocart {
        float: right;

        .sui-btn {
          padding: 7px 36px;
          font-size: 15px;
          line-height: 22px;
          color: #333;
          background-color: rgb(212, 211, 211);
          text-decoration: none;
          box-sizing: border-box;
          border: 1px solid #e1e1e1;
        }

        .sui-btn:hover {
          background-color: #f7f7f7;
          border: 1px solid #eaeaea;
        }

        .sui-btn:active {
          background-color: #e1e1e1;
          border: 1px solid #d5d5d5;
        }

        .btn-danger {
          background-color: #3498db;
          color: #fff;
          margin-left: 10px;
        }

        .btn-danger:hover {
          background-color: #3498db;
        }
      }
    }
  }
}
</style>
